package com.ruoyi.web.controller.test;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.file.service.IFtpFileService;
import org.apache.commons.net.ftp.FTPClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

@Controller
@RequestMapping("/stest")
public class STestController{

    @Autowired
    private IFtpFileService iFtpFileService;

    @PostMapping("ftpA")
    @ResponseBody
    public AjaxResult ftpA() throws IOException {
        String elativefilePath = "ftps/ff/yy";
        String fileName = "yyyyyy.xlsx";
        InputStream inputStream = new FileInputStream(new File("C:/Users/羡慕南飞的燕/Desktop/ceshi/ccc.xlsx"));//指定路径);
        iFtpFileService.uploadFtpFile(elativefilePath, fileName, inputStream);
        return AjaxResult.success("success");
    }


}
